#ifndef IDOORCONTROLBOARD_H_
#define IDOORCONTROLBOARD_H_

#include <memory>
#include "IDevice.h"
#include "zlbase/transport/ICommonDCBTransport.h"

namespace zl {
namespace zlbase {

/// \brief 开门板接口类
///
/// 该接口类主要提供了常用的几种开门板通用接口（比如以太网口开门板，RS485开门板）
/// 通过不同的协议层，链路层搭配实现适应多种类型开门板的需求
class IDoorControlBoard : public IDevice
{
public:
    IDoorControlBoard() : col_(-1), transport_(nullptr) {}
    virtual ~IDoorControlBoard() = default;

    inline void SetCol(int32_t col) { col_ = col; }
    inline int32_t GetCol() { return col_; }

    inline void SetTransport(std::shared_ptr<ICommonDCBTransport> transport)
    { transport_ = transport; }
    std::shared_ptr<ICommonDCBTransport> GetTransport()
    { return transport_; }

    /// need to impl
    /// \brief 打开指定的箱门
    virtual int32_t OpenLocker(int32_t index) = 0;

    /// \brief 获取门磁状态
    virtual int32_t GetDoorStatus(unsigned char* status, size_t& len) = 0;

    /// \brief 获取物品状态
    virtual int32_t GetItemStatus(unsigned char* status, size_t& len) = 0;

protected:
    int32_t col_;

    std::shared_ptr<ICommonDCBTransport> transport_;
};

}
}

#endif // IDOORCONTROLBOARD_H_
